var OnlineStoreLogoutModule = { initialize: function () { var module = this; $(document).on('click', '.log-out', function (event) { module.logout(event); }); }, logout: function (event) { var module = this; event.preventDefault(); event.stopPropagation(); OnlineStoreLoadingModule.show(); var data = {}; OnlineStoreApiModule.make_api_post_request_processing_data(ONLINE_STORE_API_LOGOUT_URL_SEGMENT, data, function (response) { window.location.reload(); }, function (response) { OnlineStoreLoadingModule.hide(); if (typeof response.responseJSON !== 'undefined' && typeof response.responseJSON.errors !== 'undefined') { OnlineStoreErrorsModule.show(response.responseJSON.errors); return; } OnlineStoreErrorsModule.show_500_error(); }); }, }; $(function () { OnlineStoreLogoutModule.initialize(); });